<!DOCTYPE HTML>
 <html>
 <?php 
require_once'config.php';
require_once'functions.php';
$studentID= $_SESSION['studentID'];
$attempt = $_SESSION['attempt'];
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{

	$finishTest = finishTest($studentID, $attempt, $testID);
}
if ($_SESSION['score'] <= 5) {
     $resultsFeedback = "Based on your score you may find it useful to revisit the teaching materials or contact your tutor who will be able to offer you further support.";
}
if ($_SESSION['score'] >= 6 && $_SESSION['score'] < 9){
    $resultsFeedback = "You have achieved a healthy score. Why not view your full feedback report to get recommendations on further learning opportunities.";
}
if ($_SESSION['score'] >= 9){
       $resultsFeedback = "This is a great score! Well done. You clearly have a good grasp of the content. Why not visit your full report for additional resources which may deepen your knowledge.";
}

?>
<head>
<title>Form</title>
<link rel="stylesheet" href="styles/styles.css" type="text/css" />
<body>
<div class="overlayResult"></div>
<div class="modalResult">
  <h3>You have scored:</h3>
  <h1><?php echo $_POST ['score']; ?>/10</h1>
  <progress id='finalProgress' value='<?php echo $_POST['score']?>' max='10'> <?php echo $_POST['score']?> </progress>
<h3>General Feedback:</h3>
  <p><?php echo $resultsFeedback ?></p>
  <h2>Find out how you compare, <?php echo ucfirst($_SESSION ['firstName'])?>?</h2>
<!--  <form method='post' action="postquiz.php" id="feedback">
    <input type='submit' id='retake' name='retake' value='Retake Assessment'  class='btn'>
	<input type="hidden" name="num" value="<?php echo $num ?>">
    <input type="hidden" name="score" value="<?php echo $score ?>">
    <input type="hidden" name="attempt" value="<?php echo$_SESSION ['attempt'] ?>">
     </form>    -->
  <form method='post' action="report.php" id="report">
 <input type='submit' id='goReport' name='goReport' value='Get more feedback and compare attempts' class='btn'>
	<input type="hidden" name="num" value="<?php echo $num ?>">
    <input type="hidden" name="score" value="<?php echo $score ?>">
    <input type="hidden" name="attempt" value="<?php echo ($_SESSION ['attempt'] + 1) ?>"> 
    </form>
    </div>
</body>
</html>